home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-23 | 979 b | 38 lines |
- import java.util.*;
- public class ThingHolder extends Thing
- {
- // This is a Thing that contains a Vector of other
- // Things (its decsendents include Room and Person)
-
- private Vector things;
-
- ThingHolder( String aName, String aDescription ){
- // constructor
- super( aName, aDescription );
- this.things = new Vector(); // create a Vector of things
- }
-
- // access methods
- // things
- Vector getthings() {
- return things;
- }
-
- void setthings(Vector someThings) {
- this.things = someThings;
- }
-
- // add a single Thing to Vector things
- void addthing( Thing t ) {
- things.addElement( t );
- }
-
- // add a whole Vector of Thing objects to Vector things
- void addthings( Vector v ) {
- for (Enumeration e = v.elements(); e.hasMoreElements(); ) {
- this.things.addElement((Thing)e.nextElement());
- }
- }
-
-
- }